package com.lzx.guanchajava.view

import android.view.View
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.lzx.guanchajava.util.App
import com.lzx.guanchajava.util.ImageUtils

@BindingAdapter("imageFromUrl")
fun bindingImageFromUrl(view: ImageView, url: String?) {
    if (!url.isNullOrEmpty()) {
        Glide.with(App.getContext())
                .load(url)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(view)
    }
}

/*@BindingAdapter("onLongClick")
fun bindingOnImageLongClick(ancherView: View, imageUtil: String) {
    ImageUtils.saveImageWithPopup(imageUtil,ancherView)
}*/
